@import '../../../../styles/colors.css';

.EventCard {
  &[data-dragging],
  &[data-resizing] {
    opacity: 0.5;
  }

  &:hover .DayGridEventResizeHandler {
    opacity: 1;
  }
}

.DayGridEventTitle {
  margin: 0;
  color: var(--event-primary-text);
  font-weight: var(--font-weight-2);
  font-size: var(--font-size-1);
  line-height: var(--line-height-1);
}

.DayGridEventTime {
  display: inline-block;
  color: var(--event-secondary-text);
  font-weight: var(--font-weight-1);
  font-size: var(--font-size-1);
  line-height: var(--line-height-1);
  white-space: nowrap;
  width: 150px;
}

.EventCard--compact {
  container-type: inline-size;
  border-radius: var(--radius-3);
  background-color: var(--event-background);
  cursor: pointer;
  height: fit-content;
  position: relative;
}

.EventColorIndicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--event-color-9);
  margin-top: var(--space-05);
}

.EventCard--filled,
.EventCard--invisible,
.EventCard--placeholder {
  container-type: inline-size;
  border-radius: var(--radius-3);
  background-color: var(--event-background);
  min-width: 18px;
  height: auto;
  cursor: pointer;
  position: relative;
  z-index: 1;
  grid-row: var(--grid-row);
  grid-column: 1;
  padding: 0 var(--space-1);
  /* calculate the column spanning accounting for the spaces between columns and the borders */
  width: calc(
    var(--grid-column-span) * 100% + (var(--grid-column-span) - 1) * 2 * var(--space-1) +
      (var(--grid-column-span) - 1) * 1px
  );
}

.EventCard--invisible {
  width: 100%;
  visibility: hidden;
  height: 18px;
}

.EventCard--placeholder {
  z-index: 2;
}

.EventCard--compact .DayGridEventCardContent {
  margin: 0;
  height: var(--line-height-1);
  line-height: var(--line-height-1);
}

.DayGridEventCardWrapper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline: var(--space-2);
}

.EventCard--compact:active {
  background-color: var(--interactive-active-bg);
}

.EventCard--compact:hover {
  background-color: var(--interactive-hover-bg);
}

.MonthViewCell.Today .EventCard--compact:hover {
  background-color: var(--primary-3);
}

.MonthViewCell.Today .EventCard--compact:active {
  background-color: var(--primary-4);
}

/* Smaller containers (month view) */
@container (width < 300px) {
  .EventCard--compact .DayGridEventCardWrapper {
    padding: 0 0 0 var(--space-1);
    gap: var(--space-1);
  }

  .DayGridEventTime {
    display: inline;
  }

  .DayGridEventTimeEnd {
    display: none;
  }

  .DayGridEventTitle {
    margin-inline-start: var(--space-1);
    padding-inline-end: var(--space-3);
  }
}

.DayGridEventResizeHandler {
  position: absolute;
  width: 4px;
  top: 0;
  bottom: 0;
  z-index: 3;
  cursor: ew-resize;
  opacity: 0;

  &[data-start] {
    left: 0;
  }

  &[data-end] {
    right: 0;
  }
}
